<?php

require_once('include/GeneralTop.php');
require('include/class/db.php');
require('include/class/pagination.php');

$db = new db;

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['Index_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['Index_Username']);
  unset($_SESSION['member_id']);
  unset($_SESSION['MM_Username_id']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['MM_Username']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}

// *** Validate request to login to this site.
$loginFormAction = $_SERVER['PHP_SELF'];

if (isset($_POST['txtLoginName'])) {
  $loginUsername = $_POST['txtLoginName'];
  $password = $_POST['txtPassword'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "index.php";
  $MM_redirectLoginFailed = "index.php";
  $MM_redirecttoReferrer = true;
  
  $sql = sprintf("SELECT member_id, member_login, password, role FROM member_info WHERE member_login=%s AND password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString(md5($password), "text")); 

  $res = $db->query($sql);
  $loginFoundUser = $db->num($res);
  if (0 < $loginFoundUser) {
      $row = $db->fetch($res);
      //declare two session variables and assign them
      $_SESSION['Index_Username'] = $loginUsername;
      $_SESSION['MM_UserGroup'] = $row['role'];
      $_SESSION['member_id'] = $row['member_id'];
      $_SESSION['MM_Username_id'] = $row['member_id'];
	  
	  if(MEMBER_SITE_ADMIN === (int)$row['role'] || MEMBER_CONTENT_ADMIN === (int)$row['role'] || MEMBER_PAID === (int)$row['role']) {
	  	  $_SESSION['MM_Username'] = $loginUsername;
	  }
      if (isset($_SESSION['PrevUrl'])) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
      }
      header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}

$noti_suc = false;
if(isset($_POST['notification']) && $_POST['notification'] == 'yes') {
	$sql_insert = "insert into emailcollection set nickname='".$_POST['noti_nickname']."',
						ECEmail='".$_POST['noti_mail']."'";
	$db->query($sql_insert);
	$noti_suc = true;
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>上海小动物保护分会(SSAPA)</title>
<link href="Felix_css.css" rel="stylesheet" type="text/css" />
<link href="common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript" src="include/lib/jQuery/jquery.js"></script>
<script type="text/javascript" src="include/lib/thickbox/thickbox.js"></script>
<link rel="stylesheet" href="include/lib/thickbox/thickbox.css" type="text/css" />
</head>

<body topmargin="0" leftmargin="0">
<table width="1001" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="300" height="95" align="left" valign="bottom"><a href="index.php"><img src="images/ssapa_01.gif" width="304" height="95" border="0" alt="Go to home page"/></a></td>
    <td align="right" valign="top"  ><table width="700" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="10"></td>
      </tr>
    </table>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="font_12px_black" width="503" align="right">
          <?php 
          if (isset($_SESSION['Index_Username'])) {
			  printf (TEXT_WELCOME_LOGIN, $_SESSION['Index_Username']);
	          echo " <a href='".WEBSITE_HOST."/AssociationActivity/Profile.php?action=edit'>".TEXT_MODIFY_PROFILE."</a> | ";
			  echo " <a href='". $logoutAction ."'>".TEXT_LOG_OUT."</a>";
		  }
		  ?>
          </td>
          <td width="30" class="font_12px_black"  ></td>
          <td width="66"  ><a href="<?php echo $_SERVER['PHP_SELF']?>?lang=chinese"><img src="images/ssapa_04.gif" width="66" height="14" border="0" /></a></td>
          <td width="71"  ><a href="<?php echo $_SERVER['PHP_SELF']?>?lang=english"><img src="images/ssapa_05.gif" width="71" height="14" border="0" /></a></td>
          <td width="30"  ></td>
        </tr>
      </table>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"  ></td>
        </tr>
      </table>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td  >&nbsp;</td>
          <td width="100" align="center"  ><a href="index.php"><img src="images/<?php echo $_SESSION['lang']?>/ssapa_10.gif" width="71" height="16" border="0" /></a></td>
          <td   width="1" ><img src="images/ssapa_12.gif" width="1" height="16" alt="" /></td>
          <td width="100" align="center"  ><a href="AssociationIntro/BaseFrame.php"><img src="images/<?php echo $_SESSION['lang']?>/ssapa_14.gif" width="71" height="16" border="0" /></a></td>
          <td   width="1" ><img src="images/ssapa_12.gif" width="1" height="16" alt="" /></td>
          <td width="100" align="center"  ><a href="AssociationActivity/BaseFrame.php"><img src="images/<?php echo $_SESSION['lang']?>/ssapa_16.gif" width="70" height="16" border="0" /></a></td>
          <td   width="1" ><img src="images/ssapa_12.gif" width="1" height="16" alt="" /></td>
          <td width="100" align="center"  ><a href="RescuePets/BaseFrame.php"><img src="images/<?php echo $_SESSION['lang']?>/ssapa_18.gif" width="71" height="16" border="0" /></a></td>
          <td   width="1" ><img src="images/ssapa_12.gif" width="1" height="16" alt="" /></td>
          <td width="100" align="center"  ><a href="KnowledgeOfPets/BaseFrame.php"><img src="images/<?php echo $_SESSION['lang']?>/ssapa_20.gif" width="70" height="16" border="0" /></a></td>
          <td   width="1" ><img src="images/ssapa_12.gif" width="1" height="16" alt="" /></td>
          <td width="100" align="center"  ><a href="http://bbs.petunion.com"><img src="images/<?php echo $_SESSION['lang']?>/ssapa_22.gif" width="71" height="16" border="0" /></a></td>
          <td width="30"  >&nbsp;</td>
        </tr>
      </table>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"></td>
        </tr>
      </table>
      <?php
      /*
      $adopted_sql = "select PType, age_grp from pet_info";
      $adopted_res = $db->query($adopted_sql);
      $cat_kid = 0;
      $cat_ad = 0;
      $dog_kid = 0;
      $dog_ad = 0;
      $other = 0;
      while($adopted_row = $db->fetch($adopted_res)) {
     	  if(PET_TYPE_CAT === (int)$adopted_row['PType'] && 1 === (int)$adopted_row['age_grp']) {
     	  	  $cat_kid ++;
     	  }
     	  else if(PET_TYPE_CAT === (int)$adopted_row['PType'] && 2 === (int)$adopted_row['age_grp']) {
     	  	  $cat_ad ++;
     	  }
     	  else if(PET_TYPE_DOG === (int)$adopted_row['PType'] && 1 === (int)$adopted_row['age_grp']) {
     	  	  $dog_kid ++;
     	  }
     	  else if(PET_TYPE_DOG === (int)$adopted_row['PType'] && 2 === (int)$adopted_row['age_grp']) {
     	  	  $dog_ad ++;
     	  }
     	  else {
     	  	  $other ++;
     	  }
      }
      $total = $cat_kid + $cat_ad + $dog_kid + $dog_ad + $other;
      */
      ?>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="65">&nbsp;	</td>
          <td width="606">
          <div align="justify">
          <!--
          	<span class="font_12px_green"> <strong>&nbsp;&nbsp;成功领养案例</strong>：&nbsp;</span>
          	<span class="font_12px_black">&nbsp;&nbsp;幼猫 </span>
          	<span class="font_12px_orange"><?php echo $cat_kid?></span>
          	<span class="font_12px_black">只 &nbsp;&nbsp;|&nbsp;&nbsp; 成猫 </span>
          	<span class="font_12px_orange"><?php echo $cat_ad?></span>
          	<span class="font_12px_black">只 &nbsp;&nbsp;|&nbsp;&nbsp; 幼犬 </span>
          	<span class="font_12px_orange"><?php echo $dog_kid?></span>
          	<span class="font_12px_black">只 &nbsp;&nbsp;| &nbsp;&nbsp;成犬 </span>
          	<span class="font_12px_orange"><?php echo $dog_ad?></span>
          	<span class="font_12px_black">只&nbsp;&nbsp; |&nbsp;&nbsp; 其它 </span>
          	<span class="font_12px_orange"><?php echo $other?></span>
          	<span class="font_12px_black">只&nbsp;&nbsp; |&nbsp;&nbsp; 总数 </span>
          	<span class="font_12px_red"><?php echo $total?></span>
          	<span class="font_12px_black">只</span>
		  -->
		  <?php
          $announce_sql = "select * from announcement order by status DESC, create_date DESC limit 1";
          $announce_res = $db->query($announce_sql);
          $announce_row = $db->fetch($announce_res);
          ?>
          <MARQUEE DIRECTION="LEFT" SCROLLAMOUT="10" SCROLLDELAY="100" class="font_12px_black">
          <?php echo $announce_row['content']?>
          </marquee>
          </div>
          </td>
          <td width="30"  >&nbsp;</td>
        </tr>
    </table></td>
  </tr>
  <tr><td colspan="2">
  <div class="menu">
     <div class="menu_left"></div>
	 <div class="menu_center">
	   <span class="font_12px_white">
	     <strong>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo INDEX_HEADLINE?><!--<input type="text" name="seach" size="5" />&nbsp;&nbsp;搜索-->	
	     </strong>
	   </span>
     </div>
	 <div class="menu_right"></div>
  </div>
  <!-- 改版头部，增加图片切换 和 新闻-->
  <div class="content_menu">
  <div class="content_menu_left">
<?php include('photo.php')?>
<?php 
	$news = $db->query("SELECT `NId`, `NTitle`, `Nid`, `NType` FROM newsinfo ORDER BY pub_date DESC LIMIT 5");
	$news_first = $db->fetch($news);
?>
  </div>
  <div class="content_menu_right font_12px_black">
    <div class="content_menu_right_left">
	<table width="363" height="81" cellpadding="0" cellspacing="0" class="font_12px_black">
	<tr>
	<td width="21" height="79" rowspan="3" align="center" valign="top">&nbsp;</td>
	<td width="121" height="79" rowspan="3" align="center" valign="top"><img src="images/news.jpg" height="62px" width="93px" class="img_border"/></td>
	<td width="232" height="28"><span class="font_14px_green">[<?php echo getNewsType($news_first['NType']) ?>]</span></td>
	</tr>
	<tr>
	  <td height="36" valign="top" style='word-break:break-all'><strong><a target="_blank" href="/AssociationActivity/ActivityNewsDetails.php?recordID=<?php echo $news_first['NId']?>"><?php echo $news_first['NTitle']?></a></strong></td>
	  </tr>
	<tr>
	  <td height="15">&nbsp;</td>
	  </tr>
	</table>
	<!-- 首页新闻 -->
	<table width="387" height="96" cellpadding="0" cellspacing="0" class="font_12px_black">
	<?php while($item = $db->fetch($news)) {?>
	<tr>
	<td width="52" height="22"></td>
	<td>[<?php echo getNewsType($item['NType'])?>] <a target="_blank" href="/AssociationActivity/ActivityNewsDetails.php?recordID=<?php echo $item['NId']?>"><?php echo $item['NTitle']?></a></td>
	</tr>
	<?php }?>
	</table>
	</div>
	<div class="content_menu_right_right">
          <table width="100%" height="150px" border="0" cellpadding="0" cellspacing="0" >
          <tr>
            <td  >&nbsp;</td>
          </tr>
        </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0"><form id="loginFrm" method="POST" action="<?php echo $loginFormAction; ?>">
          <?php
          if(isset($_SESSION['Index_Username'])) {
          ?>
          	<tr>
              <td width="180" height="28" align="right" class="font_12px_white" style="margin-left:20px;"><?php echo sprintf(TEXT_ALREADY_SIGNIN, $_SESSION['Index_Username'])?></td>
              <td width="100"  rowspan="2" align="left"  >&nbsp;</td>
            </tr>
          <?php
          }
          else {
		  ?>
            <tr>
              <td width="160px" height="28" align="right" class="font_12px_white"  ><?php echo TEXT_USERNAME?>：</td>
              <td width="82" align="left"  ><input name="txtLoginName" type="text" class="input_text_grayborder1px_bgFFF" id="txtLoginName" style="width:80px;" /></td>
              <td width="16"  rowspan="2" align="left"  >&nbsp;</td>
              <td width="76"  rowspan="2" align="left"  background="images/tou.gif" ><input type="image"  name="imgBtn" src="images/tou.gif" onClick="document.getElementById('loginFrm').submit();" width="47" height="47" border="0"/></td>
            </tr>
            <tr>
              <td height="28" align="right" class="font_12px_white"  ><?php echo TEXT_PASSWORD?>：</td>
              <td align="left"  ><input name="txtPassword" type="password" class="input_text_grayborder1px_bgFFF" id="txtPassword" style="width:80px;" /></td>
              </tr></form>
          </table>
          <table width="100%" height="20px" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td align="center" valign="middle">
                <a href="#" class="font_12px_white" onclick="document.getElementById('loginFrm').reset();return false;"><?php echo TEXT_CLEAR?></a> 
              	<span class="font_12px_white">|</span> <a href="reclaimPass.php?KeepThis=true&TB_iframe=true&height=200&width=400" class="thickbox" title="<?php echo TEXT_RECLAIM_PASS?>" id="thickbox_ahref"><?php echo TEXT_FORGET_PASS?></a>
              	<span class="font_12px_white">|</span> <a href="AssociationActivity/Profile.php?action=new" class="font_12px_white"><?php echo TEXT_REGISTER?></a>
              </td>
            </tr>
          </table>
          <table width="100%" height="49" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td align="center" valign="middle"><a href="popup.php?KeepThis=true&TB_iframe=true&height=400&width=600" class="thickbox" title="<?php echo TEXT_HOW_TO_REGISTER?>" id="thickbox_ahref"><?php echo TEXT_HOW_TO_REGISTER?></a></td>
            </tr>
          <?php
          }
          ?>
          </table>
	</div>
  </div>
</div>
<div class="content_menu_line"></div>
     <table width="1001" border="0" align="center" cellpadding="0" cellspacing="0">
     <tr>
    <td width="228" align="left" valign="top"  >
    <!--
    <table width="95%" border="0" cellspacing="5" cellpadding="0">
      <tr>
        <td style="left:15px "><span class="font_14px_orange"><strong>赞助</strong></span><span class="font_14px_black"><strong>商家</strong></span></td>
      </tr>
    </table>
      <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="30" align="left"  ><span class="font_14px_pink"><strong>赞助</strong></span><span class="font_14px_black"><strong>商家</strong></span></td>
          <td align="right"  ><a href="#"><img src="images/ssapa_34.gif" width="40" height="13" border="0" /></a></td>
        </tr>
      </table>
    -->
      <table width="100%" border="0" cellspacing="5" cellpadding="0" >
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_39.jpg" width="196" height="60" border="0" class="img_border"/></a></td>
        </tr>
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_40.jpg" width="195" height="58" border="0" class="img_border"/></a></td>
        </tr>
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_41.jpg" width="195" height="58" border="0" class="img_border"/></a></td>
        </tr>
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_42.jpg" width="195" height="58" border="0" class="img_border"/></a></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"  ></td>
        </tr>
      </table>
      <!--
      <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="30" align="left"  ><span class="font_14px_orange"><strong>合作</strong></span><span class="font_14px_black"><strong>伙伴</strong></span></td>
          <td align="right"  ><a href="#"><img src="images/ssapa_34.gif" width="40" height="13" border="0" /></a></td>
        </tr>
      </table>
      -->
      <table width="100%" height="19" border="0" cellpadding="0" cellspacing="5">
        <tr>
          <td><img src="images/ssapa_91.gif" width="202" height="271" /></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"  ></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0">
        <tr>
          <td height="30" align="left"  ><span class="font_14px_green"><strong>友情</strong></span><span class="font_14px_black"><strong>链接</strong></span></td>
          <td align="center" ><a href="#"><img src="images/ssapa_34.gif" width="40" height="13" border="0" /></a></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="5" cellpadding="0">
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_85.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_86.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
        </tr>
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_85.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_86.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
        </tr>
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_85.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_86.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
        </tr>
        <tr>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_85.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
          <td valign="middle"  ><a href="#"><img src="images/ssapa_86.jpg" width="95" height="40" border="0" class="img_border"/></a></td>
        </tr>
      </table>
    </td>
    <td align="left" valign="top"  ><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="490" valign="top"  ><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td  ></td>
          </tr>
        </table>
          <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="20" align="left"  ><?php echo TEXT_I_WANT_HOME?></td>
            </tr>
          </table>
          <table width="270" border="0" align="left" cellpadding="0" cellspacing="0">
            <tr>
              <td height="2" bgcolor="#FF9C00"   width="100"></td>
              <td bgcolor="#8C9494"   width="170"></td>
            </tr>
          </table></td>
        <td width="283" height="0" align="left" valign="top" >
</td>
      </tr>
    </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"  ></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="13"><img src="images/ssapa_49.gif" alt="" width="11" height="21" border="0" /></td>
          <?php
          $select_6 = "select PAId, PAPetName, PPhoto_main_thumb from pet_info where PIsAdopt=1 order by PAId DESC limit 7";
          $select_6_res = $db->query($select_6);
          while($select_6_row = $db->fetch($select_6_res)) {
              echo '<td><div class="img_border_div"><a href="RescuePets/BaseFrame.php?frmURL=RescuePetsInfo.php&index_id='.$select_6_row['PAId'].'" title="'.$select_6_row['PAPetName'].'"><img class="img_border_index" src="'.IMAGES_PET_FOLDER.$select_6_row['PPhoto_main_thumb'].'" border="0" /></a></div></td>';
          }
          ?>
          <td width="13"><img src="images/ssapa_49a.gif" width="11" height="21" border="0" /></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"  ></td>
        </tr>
      </table>
      <table width="772" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="268" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20" align="left" ><?php echo TEXT_HAPPY_HOME?></td>
                </tr>
              </table></td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#8C9494" style="table-layout:fixed;">
            <tr>
              <td height="2" bgcolor="#E75A63" width="100"></td>
              <td ></td>
            </tr>
          </table></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="10"></td>
                  </tr>
                </table>
                  <table width="268" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><a href="RescuePets/BaseFrame.php?frmURL=RescuePetsHappyCat.php"><img src="images/ssapa_68.gif" width="268" height="194" border="0"/></a></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          <td align="right" valign="top"><table width="490" border="0"  cellpadding="0" cellspacing="0">
              <tr>
                <td height="8" bgcolor="#CECECE"></td>
              </tr>
            </table>
            <table width="490" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="8" bgcolor="#CECECE">&nbsp;</td>
                <td width="160" height="150" align="left" valign="top" ><!--style="background:url(images/ssapa_71.gif); background-position:bottom,right; background-repeat:no-repeat;"-->
                <table width="100%" border="0" cellspacing="1" cellpadding="3">
                  <tr>
                    <td colspan="2"><div align="center"><img src="images/ssapa_57.gif" width="141" height="31"></div></td>
                  </tr>
                  <?php
                  $sql = "select member_id, member_name from member_info where Member_type=".MEMBER_PAID." order by member_id DESC limit 5";
                  $res = $db->query($sql);
                  while($row = $db->fetch($res)) {
	                  echo '<tr>
	                  		  <td width="10" align="right" valign="middle"><img src="images/dot.gif" width="3" height="4"></td>
							  <td width="130" class="font_12px_gray" align="left">'.$row['member_name'].'</td>
	                  		</tr>';
                  }
                  ?>
                  <tr>
                  	<td>&nbsp;</td>
                  	<td align="right"><a class="font_12px_gray" href="http://bbs.petunion.com/"><?php echo TEXT_MORE?>>></a></td>
                  </tr>
                </table></td>
                <td width="8" bgcolor="#CECECE">&nbsp;</td>
                <td width="160" align="left" valign="top" ><table width="100%" border="0" cellspacing="1" cellpadding="3">
                  <tr>
                    <td colspan="2"><div align="center"><img src="images/ssapa_59.gif" width="141" height="30"></div></td>
                  </tr>
                  <?php
                  $sql = "select member_id, member_name from member_info where Volunteer_YN=1 order by member_id DESC limit 4";
                  $res = $db->query($sql);
                  while($row = $db->fetch($res)) {
	                  echo '<tr>
	                  		  <td width="10" align="right" valign="middle"><img src="images/dot.gif" width="3" height="5"></td>
							  <td width="130" class="font_12px_gray" align="left">'.$row['member_name'].'</td>
	                  		</tr>';
                  }
                  ?>
                  <tr>
                  	<td>&nbsp;</td>
                  	<td align="right"><a class="font_12px_gray" href="http://bbs.petunion.com/"><?php echo TEXT_MORE?>>></a></td>
                  </tr>
                </table></td>
                <td width="8" bgcolor="#CECECE">&nbsp;</td>
                <td align="left" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                  <tr>
                    <td><div align="center"><img src="images/ssapa_61.gif" width="133" height="30"></div></td>
                  </tr>
                  <tr>
                    <td class="font_12px_gray"><?php echo TEXT_DONATE_INFO; ?></td>
                  </tr>
                </table></td>
                <td width="8" bgcolor="#CECECE">&nbsp;</td>
              </tr>
            </table>
            <table width="490" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="8" bgcolor="#CECECE"></td>
              </tr>
            </table>
            <table width="100%" border="0"   cellspacing="0" cellpadding="0">
              <tr>
                <td height="10"></td>
              </tr>
            </table>
            <table width="490" border="0"  cellpadding="0" cellspacing="0" bgcolor="#339900">
              <tr>
                <td height="50"></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20" align="left" ><?php echo TEXT_PET_LOST_AND_FOUND?></td>
                </tr>
              </table></td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="95%" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#8C9494" style="table-layout:fixed;">
            <tr>
              <td height="2" bgcolor="#6B8400" width="100"></td>
              <td ></td>
            </tr>
          </table></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="10"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="106" height="10" align="center" valign="middle"><img src="images/ssapa_88.gif" width="98" height="98"></td>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <?php
                  $sql = "select PId, PPhoto_thumb, SUBSTRING(PDescription,1,13) AS description from petlostfound order by PId DESC limit 5";
                  $res = $db->query($sql);
                  while($row = $db->fetch($res)) {
                  ?>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="10" align="center" valign="middle"><img src="images/dot.gif" width="3" height="5"></td>
                    <td height="20" class="font_12px_gray"><a class="gray_12px" href="RescuePets/BaseFrame.php?frmURL=RescuePetsLostDetails.php&index_lost_id=<?php echo $row['PId']?>"><?php echo $row['description']?>...</a></td>
                  </tr>
                  </table>
                  <?php
                  }
                  ?>
                </td>
              </tr>
            </table></td>
          <td width="300" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20" align="left" ><?php echo TEXT_PET_KNOW?></td>
                </tr>
              </table></td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="95%" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#8C9494" style="table-layout:fixed;">
            <tr>
              <td height="2" bgcolor="#6B8400" width="100"></td>
              <td ></td>
            </tr>
          </table></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="10"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="106" height="10" align="center" valign="middle"><img src="images/ssapa_44.gif" width="98" height="98"></td>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <?php
                  $sql = "select Id, SUBSTRING(mal_title,1,13) AS title from petmanual order by Id DESC limit 5";
                  $res = $db->query($sql);
                  while($row = $db->fetch($res)) {
                  ?>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <td width="10" align="center" valign="middle"><img src="images/dot.gif" width="3" height="5"></td>
                    <td height="20" class="font_12px_gray"><a class="gray_12px" href="KnowledgeOfPets/BaseFrame.php?frmURL=FosterGuideinfo.php&index_id=<?php echo $row['Id']?>"><?php echo $row['title']?>...</a></td>
                  </tr>
                  </table>
                  <?php
                  }
                  ?>
				</td>
              </tr>
            </table></td>
          <td width="166" height="157" align="left" valign="top" background="images/ssapa_81.gif"><table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>          
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><div align="center">
                  <input name="hosname" id="hosname" type="text" class="input_text_grayborder1px_bgFFF" id="textfield5" style="width:120px;" />
                </div></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><div align="center">
                  <select name="ddlDistrict" class="input_text_grayborder1px_bgFFF" id="ddlDistrict" >
                    <option value="all"><?php echo TEXT_ALL?></option>
			        <?php
			        foreach($district_arr as $_key => $_value) {
			        	echo '<option value="'.urlencode($_value).'">'.$_value.'</option>';
			        }        
			        ?>
                  </select>
                </div></td>
              </tr>            
            </table>            
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="48"><div align="center">
                  <input type="button" id="button" value="<?php echo TEXT_SUBMIT?>" onclick="transfer_to_search();">
                </div></td>
              </tr>
            </table></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"></td>
        </tr>
      </table>
      <?php
      if($noti_suc) {
      	  echo '<script>alert("'.TEXT_SUSCRIB_SUC.'");</script>';
      }
      ?>
      
      <form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST" id="notification">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="307" height="252" align="left" valign="top" background="images/ssapa_95.gif"><table width="100%" height="41" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="162" height="28" align="right" class="font_12px_black"  ><?php echo TEXT_NICKNAME?>：</td>
                <td width="87" align="left"  ><input name="noti_nickname" id="noti_nickname" type="text" class="input_text_grayborder1px_bgFFF" style="width:80px;" /></td>
                <td width="58"  rowspan="2" align="left"  >&nbsp;</td>
              </tr>
              <tr>
                <td height="28" align="right" class="font_12px_black"  ><?php echo TEXT_EMAIL?>：</td>
                <td align="left"  ><input name="noti_mail" id="noti_mail" type="text" class="input_text_grayborder1px_bgFFF" style="width:80px;" /></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="10"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="31%" height="30"></td>
                <td width="28%"><input type="image" name="reset_form" src="images/tou.gif" width="86" height="27" border="0" onClick="document.getElementById('notification').reset();return false;"/></td>
                <td width="35%"><input type="image" name="submit_form" src="images/tou.gif" width="95" height="27" border="0" onClick="return checkNoti();document.getElementById('notification').submit();"/></td>
                <td width="6%"></td>
              </tr>
            </table></td>
          <input type="hidden" name="notification" value="yes">
          </form>
          <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><div align="right"><a href="#"><img src="images/ssapa_97.gif" width="458" height="118" border="0"></a></div></td>
            </tr>
          </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="10"></td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="50%" height="10" align="center" valign="middle"><a href="#"><img src="images/ssapa_101.gif" width="224" height="117" border="0"></a></td>
                <td width="50%" align="center" valign="middle"><a href="#"><img src="images/ssapa_101.gif" width="224" height="117" border="0"></a></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="5"></td>
  </tr>
</table>
<table width="1001" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top" bgcolor="F7F7F7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="10"></td>
      </tr>
    </table>
      <table width="700" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="11" height="26"><img src="images/copyright_01.gif" width="11" height="26"></td>
          <td background="images/copyright_03.gif" class="font_12px_gray"><div align="center">上海市畜牧兽医学会小动物保护分会   2009年   版权所有    沪ICP备06004930号</div></td>
          <td width="12"><img src="images/copyright_04.gif" width="12" height="26"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"><div align="center" class="font_12px_gray">电话：021-61432446  传真：021-61432448  Email: ssapa.info@yahoo.com.cn (中文), helpttheanimals@yahoo.cn (English)</div></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="10"></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
<script language="javascript">
function transfer_to_search() {
	var param = 'index_param=yes&hosname='+encodeURI(document.getElementById('hosname').value)+'&ddlDistrict='+document.getElementById('ddlDistrict').value;
	var url = 'KnowledgeOfPets/BaseFrame.php?'+param;
	window.location.href=url;
}

function checkNoti() {
  	if(document.getElementById('noti_nickname').value == '') {
  	    alert('请输入昵称');
  	  	document.getElementById('noti_nickname').focus();
  	  	return false;
  	}
  	if(document.getElementById('noti_mail').value == '') {
  	  	alert('请输入邮件地址');
  	  	document.getElementById('noti_mail').focus();
  	  	return false;
  	}
  	if(!checkEmail(document.getElementById('noti_mail').value)) {
  		alert('邮件地址格式不正确');
  	  	document.getElementById('noti_mail').focus();
  	  	return false;
  	}
  	return true;
}

function checkEmail(email){
	var reEmail = /^([A-Za-z0-9])(\w)+@(\w)+(\.)(com|com\.cn|net|cn|net\.cn|org|biz|info|gov|gov\.cn|edu|edu\.cn)/;
	if (!email.match(reEmail) && email!="") {
        return false;
    }
    else {
    	return true;
    }
}
</script>